import request from '../utils/request';
import { mapToParam } from '../utils';

// 查询数据库项目详情
export function fetchProject( {name} ) {
  return request(`api/GetProjectInfo/?name=${name}`, {
    method: 'GET',
    headers: {
      Accept: 'application/json',
      'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8', // 接收x-www-form-urlencoded类型的参数
    },
    // body: JSON.stringify(params),
  });
}
// 获取jira项目详情
export function getJiraProjectInfo(){
    return request(`api/GetJira`,{
        method:'GET',
        headers:{
            Accept: 'application/json',
            'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8', // 接收x-www-form-urlencoded类型的参数
        }
    })
}

export function addProject(param) {
  return request('api/AddProject/', {
    method: 'POST',
    headers: {
      Accept: 'application/json',
      'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
    },
    body: mapToParam(param),
  });
}
export function updateProject(param) {
  return request('api/UpdateProject/', {
    method: 'POST',
    headers: {
      Accept: 'application/json',
      'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
    },
    body: mapToParam(param),
  });
}

export function deleteProject(recordParams) {
  return request('api/DeleteProject/', {
    method: 'POST',
    headers: {
      Accept: 'application/json',
      'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
    },
    body: mapToParam(recordParams),
  });
}
// 执行job,同步jira原始数据
export function executeJobs(){
    return request(`api/executejobs`,{
        method:'GET',
        headers:{
            Accept: 'application/json',
            'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8', // 接收x-www-form-urlencoded类型的参数
        }
    })
}